// Package service
// Title  		validation.service.go
// Description  ClusterService服务层
// Author  		alittlexincan@163.com  		2024/07/22 11:36
// Update  		alittlexincan@163.com  		2024/07/22 11:36
package service

import (
	"context"
	"strconv"

	"go.uber.org/zap"
	"xincan.com.cn/tarot-go/internal/app/example/validation/dto"
	"xincan.com.cn/tarot-go/internal/app/example/validation/vo"
	"xincan.com.cn/tarot-go/internal/tarot"
)

// ValidationInterface
// Title    		ValidationInterface
// Description   	验证器接口
// Author      		alittlexincan@163.com         	2024/07/22 11:36∂
// Update      		alittlexincan@163.com         	2024/07/22 11:36
type ValidationInterface interface {

	// SearchValidation 创建验证器
	SearchValidation(ctx context.Context, model *dto.SearchValidationDto) ([]*vo.SearchValidationVo, error)
}

// ValidationService
// Title    		ValidationService
// Description   	验证器接口服务实现结构体
// Author      		alittlexincan@163.com         	2024/07/22 11:36
// Update      		alittlexincan@163.com         	2024/07/22 11:36
type ValidationService struct {
}

// NewValidationService
// Title    		NewValidationService
// Description   	创建验证器接口服务实现
// Author      		alittlexincan@163.com         	2024/07/22 11:36
// Update      		alittlexincan@163.com         	2024/07/22 11:36
// Return 			UserService						返回验证器接口服务实现结构体
func NewValidationService() *ValidationService {
	return &ValidationService{}
}

// SearchValidation 查询验证器
// Author      		alittlexincan@163.com         						2024/07/22 11:36
// Update      		alittlexincan@163.com         						2024/07/22 11:36
// Param 			model					*dto.CreateUserDto			创建验证器参数
// Return 			[]*vo.SearchValidationVo												创建验证器结果
// Return 			error												创建验证器错误
func (user *ValidationService) SearchValidation(ctx context.Context, model *dto.SearchValidationDto) ([]*vo.SearchValidationVo, error) {
	tarot.Logger.ContextLogger(ctx).Info("创建验证器成功", zap.Any("model", model))
	_, err := strconv.ParseInt("id", 10, 64)
	if err != nil {
		//tarot.Logger.ContextLogger(ctx).Error("验证器管理-ctx-失败", zap.Error(err))
		//tarot.Logger.ContextLogger(ctx).Error("验证器管理-失败", zap.Error(err))
		//return nil, ve.NewValidationException(exception.ErrSearchValidationFailed).WithError(err)
		//return nil, exception.ErrSearchValidationFailed.WithError(err)
		//return nil, exception.ErrSearchValidationFailed
	}
	return []*vo.SearchValidationVo{
		{
			Id:         1142681887794270208,
			Name:       "admin",
			Password:   "Abc123",
			Role:       "管理员",
			Status:     "READY",
			Type:       "TEACHER",
			CreateTime: 1731403219000,
		},
	}, nil

}
